package com.itheima.Jiuye09;

public class Student implements Comparable<Student>{
    private  String name;
    private  int yinyu;
    private  int shuxue;
    private  int yuwen;

    public Student() {
    }

    public Student(String name, int yinyu, int shuxue, int yuwen) {
        this.name = name;
        this.yinyu = yinyu;
        this.shuxue = shuxue;
        this.yuwen = yuwen;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getYinyu() {
        return yinyu;
    }

    public void setYinyu(int yinyu) {
        this.yinyu = yinyu;
    }

    public int getShuxue() {
        return shuxue;
    }

    public void setShuxue(int shuxue) {
        this.shuxue = shuxue;
    }

    public int getYuwen() {
        return yuwen;
    }

    public void setYuwen(int yuwen) {
        this.yuwen = yuwen;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", yinyu=" + yinyu +
                ", shuxue=" + shuxue +
                ", yuwen=" + yuwen +
                '}'+   "和为："+getmax();
    }
    public int getmax(){
        return yinyu+shuxue+yuwen;
    }
    @Override
    public int compareTo(Student o) {
        int a = this.getmax()- o.getmax();
       a = a == 0 ? this.yuwen - o.yuwen:a;
       a = a == 0 ?this.shuxue - o.shuxue : a;
       a = a == 0 ?this.yinyu - o.yinyu : a;
        return a;
    }
}
